package com.huhu.SpringDemo;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DrilController {
	
	@Autowired
	private DrilJPA drilService;
	
	@Autowired
	private DrilService drilService2;
	
	@RequestMapping(value="/drils",method=RequestMethod.GET)
	public List<Dril> getDrils(){
		
		List<Dril> drils =drilService.findAll();
		return drils;
	}
	
	
	@RequestMapping(value="/drils/{name}",method=RequestMethod.GET)
	public List<Dril> getDrilName(@PathVariable("name")String name){
		
		List<Dril> drils =drilService.findByName(name);
		return drils;
	}
	
	@RequestMapping(value="/drils/addTwo",method=RequestMethod.GET)
	public void getDrilName(){
		
		drilService2.addTwo();;
	}
}
